const { Random } = require('mockjs');
const Mock = require('mockjs');
const myOrder = require('../model/myOrder');
const orderTime = require('../utils');

//创建数据的函数
async function myOrderData() {
	// 生产当月的开始日期
	const startDate = new Date('2023-05-06 00:00:00');
	// 截止日期
	const endDate = new Date('2023-06-10 17:00:00');
	// console.log(orderTime(startDate, endDate));

	//酒店列表数据
	const { myOrderList } = Mock.mock({
		myOrderList: [
			{
				goodsId: '',
				userId: '',
				picUrl: Random.image('200x100', '#50B347', '#FFF'),
				'title|1': [
					'拱北华山别墅',
					'趣学别野',
					'天河别野',
					'天山脚下别野',
				],
				address: Mock.mock('@city'),
				'visitor|1': [2, 3, 4, 5, 6],
				'bedNum|1': [1, 2, 3],
				'bathNum|1': [1, 2],
				'area|1': [123, 100, 90, 150],
				'price|1': [1200, 1000, 600, 1500, 1155],
				'orederstate|1': ['affirm', 'unpaid', 'refund'],
				'count|1': [1, 2],
				orderTime: orderTime(startDate, endDate),
			},
		],
	});
	const res = await Promise.all(
		myOrderList.map((item) => {
			console.log(item);
			// return myOrder.create(item);
		})
	);
}

module.exports = myOrderData;
